package com.ititer.service;

import java.util.List;

import com.ititer.AbstractBean;
import com.ititer.Service;
import com.ititer.bean.AccountBean;
import com.ititer.bean.CompetenceBean;
import com.ititer.model.Account;
import com.ititer.model.AccountDomains;
import com.ititer.model.Profile;
import com.ititer.result.LoginResult;

public interface AccountService extends Service {
	/**
	 * Do the register logic : 
	 * 1. insert an account into account table
	 * 2. save register log
	 * 3. send email including username and password to user
	 * @param registerData
	 * @return
	 */
	boolean register(AccountBean registerData);

	/**
	 * Check if the specified email is existing in system.
	 * @param email
	 * @return
	 */
	boolean isEmailExist(String email);

	/**
	 * Do the login logic.
	 * @param loginData
	 * @return
	 */
	LoginResult login(AccountBean loginData);

	/**
	 * Check if the specify uri is exist.
	 * @param uri
	 * @return
	 */
	boolean isUriExist(String uri);

	/**
	 * Save the uri of an account.
	 * @param account TODO
	 */
	boolean updateUri(AccountBean accountBean);

	/**
	 * Get the account by the uri.
	 * @param uri
	 * @return
	 */
	Account getByUri(String uri);

	/**
	 * insert or update a competence.
	 * @param competence
	 * @return
	 */
	boolean saveCompetence(CompetenceBean competence);

	/**
	 * List the competence of an user.
	 * @param userid
	 * @return
	 */
	List<CompetenceBean> listCompetence(Integer userid);

	/**
	 * Get the specified user login count.
	 * @param accountid
	 * @return
	 */
	int getLoginCount(Integer accountid);

	/**
	 * Update the domains of an account: 
	 * 	delete the removed domain and save the new added .
	 * @param account
	 * @return
	 */
	boolean updateDomain(AccountBean account);

	/**
	 * Get the domains of an account.
	 * @param accountid
	 * @return
	 */
	List<AccountDomains> getDomains(Integer accountid);

	Profile getProfile(Integer id);

	boolean updateProfile(AbstractBean bean, Integer accountid);

}
